<#assign base=request.contextPath />
<#assign oneLabel="系统管理">

<#assign twoLabel="管理员管理">
<#assign twoUrl=base+"/role/list">

<#if deptDO?? && (deptDO.id)!=0>
	<#assign leafLabel="编辑管理员">
	<#else>
	<#assign leafLabel="新增管理员">
</#if>
<!DOCTYPE html>
<html lang="en">
<head>
    <link rel="stylesheet" href="${base}/static/assets/css/chosen.css" />
    <#include "/commons/headImport.ftl">
</head>
<body>
<#include "/commons/header.ftl">
<form class="form-horizontal" name="formName" method="post">
<#include "/commons/hiddenField.ftl">
<@spring.formHiddenInput "userDO.id"/>
<div class="row">
    <div class="col-xs-12">
	    <div class="form-group">
	        <label class="col-sm-2 control-label no-padding-right">
				用户名<span class="red">*</span>
			</label>
	        <div class="col-sm-4">
	        	<input type="text" name="username" value="${userDO.username!''}" 
	        		<#if userDO??&&userDO.id!=0>readonly='true'</#if> class="col-sm-10"/>
	        </div>
	        <div class="help-block col-xs-12 col-sm-reset inline red">
	            <@spring.showErrors "userDO.username" />
	        </div>
	    </div>
	    <div class="space-4"></div>
	        
	    <div class="form-group">
	        <label class="col-sm-2 control-label no-padding-right">
				真实姓名<span class="red">*</span>
			</label>
	        <div class="col-sm-4">
	        <@spring.formInput "userDO.trueName" "class='col-sm-10' "/>
	        </div>
	        <div class="help-block col-xs-12 col-sm-reset inline red">
	        <@spring.showErrors "userDO.trueName" />
	        </div>
	    </div>
	    <div class="space-4"></div>
			
		<#if userDO??&&(userDO.id!=0||(userDO.username??&&userDO.username=='admin'))>
			<@spring.formHiddenInput "userDO.passwd"/>
		<#else>
        <div class="form-group">
            <label class="col-sm-2 control-label no-padding-right">
				密码<span class="red">*</span>
			</label>
            <div class="col-sm-4">
                <input type="password" name="passwd" value="${userDO.passwd!''}" id="pwd" class="col-sm-10"/>
            </div>
            <div class="help-block col-xs-12 col-sm-reset inline red">
            <#if userDO??>
                <@spring.bind "userDO.passwd" />
                <@spring.showErrors "<br>"/>
            </#if>
            </div>
        </div>
        <div class="space-4"></div>
                            
        <div class="form-group">
            <label class="col-sm-2 control-label no-padding-right">
				确认密码<span class="red">*</span>
			</label>
            <div class="col-sm-4">
                <input type="password" id="ok-pwd" value="${userDO.passwd!''}" class="col-sm-10" onblur="checkpwd()" />
            </div>
            <div class="help-block col-xs-12 col-sm-reset inline red" id="okpwd-msg">
            <#if userDO??>
                <@spring.bind "userDO.passwd" />
                <@spring.showErrors "<br>"/>
            </#if>
            </div>
        </div>
        <div class="space-4"></div>
    	</#if>
        
	    <div class="form-group">
	        <label class="col-sm-2 control-label no-padding-right">部门</label>
	        <div class="col-sm-3">
	            <select class="form-control dept-chosen-select" name="deptId" id="dept-select" >
	                <option value="0">--请选择--</option>
	            </select>
	             <input type="hidden" id="dep_list_id" value="${userDO.deptId!0}">
	        </div>
	    </div>
	    <div class="space-4"></div>
	    
	    <div class="form-group">
	        <label class="col-sm-2 control-label no-padding-right">职位</label>
	        <div class="col-sm-3">
	            <select class="form-control job-chosen-select" name="jobId" id="job-select">
	                <option value="0">--请选择--</option>
	            </select>
	            <input type="hidden" id="job_list_id" value="${userDO.jobId!0}">
	        </div>
	    </div>
	    <div class="space-4"></div>
	    
	    <div class="form-group">
	        <label class="col-sm-2 control-label no-padding-right">
				邮箱<span class="red">*</span>
			</label>
	        <div class="col-sm-4">
	        <@spring.formInput "userDO.email" "class='col-sm-10'"/>
	        </div>
	        <div class="help-block col-xs-12 col-sm-reset inline red">
	        <@spring.showErrors "userDO.email" />
	        </div>
	    </div>
	    <div class="space-4"></div>
	    
	    <div class="form-group">
	        <label class="col-sm-2 control-label no-padding-right">
				生日<span class="red">*</span>
			</label>
	        <div class="col-sm-4">
	            <div class="row">
	                <div class="col-xs-8">
	                    <div class="input-group input-group-sm">
	                        <input type="text" id="datepicker" readonly="true" class="form-control" name="birthday" value="${userDO.birthday!''}"/>
	                        <span class="input-group-addon"><i class="icon-calendar"></i>
	                        </span>
	                    </div>
	                </div>
	            </div>
	        </div>
	    </div>
	    <div class="space-4"></div>
	    
	    <div class="form-group">
	        <label class="col-sm-2 control-label no-padding-right">性别</label>
	        <div class="col-sm-4">
				<label>
					<input name="sex" <#if userDO.sex==0>checked="checked"</#if> value="0" type="radio" class="ace" />
					<span class="lbl">保密</span>
				</label>
				<label>
					<input name="sex" <#if userDO.sex==1>checked="checked"</#if> value="1" type="radio" class="ace" />
					<span class="lbl"> 男</span>
				</label>
				<label>
					<input name="sex" <#if userDO.sex==2>checked="checked"</#if> value="2" type="radio" class="ace" />
					<span class="lbl"> 女</span>
				</label>
	        </div>
	    </div>
	    <div class="space-4"></div>
		
	    <div class="form-group">
	        <label class="col-sm-2 control-label no-padding-right">状态</label>
	        <div class="col-sm-4">
	        	<@spring.formSingleSelect "userDO.status" statusMap 'class="col-sm-6 u-chosen-select"'/>
            </div>
        </div>
        <div class="space-4"></div>
        
    </div><!-- /.col -->
</div><!-- /.row -->
</form>
<div class="hr hr32 hr-dotted"></div>
<div class="clearfix">
    <div class="col-md-offset-2 col-md-9">
        <button class="btn btn-xs btn-info" type="button" id="save_id"
			url="<#if userDO??&&(userDO.id!=0||(userDO.username??&&userDO.username=='admin'))>${base}/user/edit<#else>${base}/user/add</#if>">
            <i class="icon-save bigger-110"></i>修改
        </button>
        <button class="btn btn-xs return_class" type="button" url="${base}/user/list">
             <i class="icon-reply bigger-110"></i>返回
        </button>
    </div>
</div> 
<#include "/commons/footer.ftl">
<script src="${base}/static/assets/js/date-time/bootstrap-datepicker.min.js"></script>
<script src="${base}/static/assets/js/date-time/bootstrap-datepicker.zh-CN.js"></script>
<script src="${base}/static/assets/js/chosen.jquery.min.js"></script>
<script src="${base}/static/js/admin/user.js"></script>
</body>
</html>
